package com.Test;

import com.dao.CourseDao;
import com.dao.StudentDao;
import com.dao.TeacherDao;
import com.dao.TestDao;
import com.domain.*;
import com.service.CourseService;
import com.service.LoginService;
import com.service.StudentService;
import com.service.TeacherService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class test {

    @Autowired
    private StudentService studentService;
    @Autowired
    private CourseDao courseDao;
    @Autowired
    private TeacherDao teacherDao;
    @Autowired
    private TeacherService teacherService;
    @Autowired
    private CourseService courseService;
    @Autowired
    private StudentDao studentDao;
    @Autowired
    private LoginService loginService;

    @Test
    public void test(){
//        ApplicationContext ap = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.println(studentService);
//        StudentService studentService = ap.getBean(StudentService.class);
    }
    @Test
    public void testCourse(){
        LoginUser user = loginService.findByName("10001");
        System.out.println(user.getPassword());
        loginService.resetPassword(user.getUserName());
        LoginUser user1 = loginService.findByName("10001");
        System.out.println(user1.getPassword());


//        PageBean bean = teacherService.findAndSearchTeacher(null,1);
//        List<Teacher> teachers = bean.getList();
//        for (Teacher teacher : teachers) {
//            System.out.println(teacher);
//        }

//        Student student = studentService.findById("10001");
//        System.out.println(student);

//        PageBean bean = studentService.findAllStudent("黄",1);
//        List<College> list = bean.getList();
//        for (College college : list) {
//            System.out.println(college);
//        }

//        PageBean bean = teacherService.findStuByCid(1,1);
//        List<StudentGrade> list = bean.getList();
//        for (StudentGrade studentGrade : list) {
//            System.out.println(studentGrade);
//        }
//        List<CourseVo> courses = testDao.find();
//        for (CourseVo cours : courses) {
//            System.out.println(cours);
//        }

//        List<StuCourse> stuCourses = testDao.stuFindCourse(1,10001);
//        for (StuCourse stuCourse : stuCourses) {
//            System.out.println(stuCourse);
//        }
//        PageBean bean = courseService.findAndSearchCourse(1, null, 12, 1001);
//        List list = bean.getList();
//        for (Object object : list) {
//            System.out.println(object);
//        }


//        List<CourseVo> courses = courseDao.findAndSearchCourse(null,0,4,2,1001);
//        for (CourseVo course : courses) {
//            System.out.println(course);
//        }
//        System.out.println(total);
//        PageBean pageBean = courseService.findAndSearchCourse(1,"设计",1,1001);
//        List<CourseVo> list = pageBean.getList();
//        for (CourseVo courseVo : list) {
//            System.out.println(courseVo);
//        }
    }

}
